package top.timestreet.xmsk.qu.boot;

import java.util.List;
import java.util.concurrent.Future;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import top.timestreet.xmsk.base.boot.CrawlerBoot;
import top.timestreet.xmsk.base.pipeline.BasePipeline;
import top.timestreet.xmsk.base.pojo.SearchPage;
import top.timestreet.xmsk.qu.processor.QuSearchPageProcessor;

/**
 * @author TateLiao
 * @data 2019年6月2日 笔趣阁搜索页面抓取启动
 */
@Component
public class QuSearchPageBoot extends CrawlerBoot<SearchPage>{
	
	 @Autowired 
	 private Environment environment;
	 
	 @Autowired 
	 private QuSearchPageProcessor quSearchPageProcessor;
	
	/**
	 * 笔趣阁搜索页抓取启动器
	 * @param resultItemsCollectorPipeline 处理途径
	 * @param name 小说名字
	 * @return
	 */
	@Async
	public Future<List<SearchPage>> startCrawt(String name) {
		BasePipeline<SearchPage> basePipline = new BasePipeline<>();
		return super.startCrawt(
				quSearchPageProcessor, 
				basePipline, 
				environment.getProperty("qu.searchURL") + name);
	}

}
